package com.newland.flow.view
{
	import com.newland.flow.Controller.Controller;
	
	import flash.events.MouseEvent;
	
	import mx.collections.ArrayCollection;
	import mx.containers.Canvas;
	import mx.containers.HBox;
	import mx.containers.VBox;
	import mx.controls.Image;
	import mx.controls.Label;

	public class BaseNodeView extends Canvas
	{
		private var _nodeType:String;
		private var _iconClass:Class;
		private var _nodeName:String;
		private var _image:Image = new Image();
		private var _lb:Label = new Label();
		private var _hbox:HBox = new HBox();
		private var _isClicked:Boolean = false;
		private var _linkToCollection:ArrayCollection = new ArrayCollection;
		
		public function BaseNodeView(icon:Class,nodeName:String)
		{
			super();
			this.image.source = icon;
			this.nodeName = nodeName;
			this.lb.text = nodeName;
			var hbox:VBox = new VBox();
			hbox.setStyle("horizontalAlign","center");
			
			hbox.addChild(image);
			if(nodeName!=null && nodeName!="")
				hbox.addChild(lb);
			this.addChild(hbox);
			
			this.addEventListener(MouseEvent.ROLL_OVER,Controller.rollOver);
			this.addEventListener(MouseEvent.ROLL_OUT,Controller.rollOut);
		}

		public function get nodeType():String
		{
			return _nodeType;
		}

		public function set nodeType(value:String):void
		{
			_nodeType = value;
		}

		public function get linkToCollection():ArrayCollection
		{
			return _linkToCollection;
		}

		public function set linkToCollection(value:ArrayCollection):void
		{
			_linkToCollection = value;
		}

		public function get isClicked():Boolean
		{
			return _isClicked;
		}

		public function set isClicked(value:Boolean):void
		{
			_isClicked = value;
		}

		public function get lb():Label
		{
			return _lb;
		}

		public function set lb(value:Label):void
		{
			_lb = value;
		}

		public function get hbox():HBox
		{
			return _hbox;
		}

		public function set hbox(value:HBox):void
		{
			_hbox = value;
		}

		public function get image():Image
		{
			return _image;
		}

		public function set image(value:Image):void
		{
			_image = value;
		}

		public function get nodeName():String
		{
			return _nodeName;
		}

		public function set nodeName(value:String):void
		{
			_nodeName = value;
		}

		public function get iconClass():Class
		{
			return _iconClass;
		}

		public function set iconClass(value:Class):void
		{
			_iconClass = value;
		}
	}
}